import baseService from '@/utils/http/axios'
/**
 * 存放公共的api 一般是第三方接口 这里
 * @param param
 */

/**
 * 开架
 * @param param
 */
export const oSListQuery: (param) => Promise<String> = (param) => {
  let qs = new URLSearchParams()
  if (param) {
    Object.keys(param).forEach((key) => qs.append(key, param[key]))
  }
  const api = `/data/OSListQuery?` + qs.toString()
  return baseService.post(api, param, {
    baseURL: '/'
  })
}

/**
 * 物料
 * @param param
 */
export const matListQuery: (param) => Promise<String> = (param) => {
  let qs = new URLSearchParams()
  if (param) {
    Object.keys(param).forEach((key) => qs.append(key, param[key]))
  }
  const api = `/data/MatListQuery?` + qs.toString()
  return baseService.post(api, param, {
    baseURL: '/'
  })
}

/**
 * 工位
 * @param param
 */
export const wsListQuery: (param) => Promise<String> = (param) => {
  let qs = new URLSearchParams()
  if (param) {
    Object.keys(param).forEach((key) => qs.append(key, param[key]))
  }
  const api = `/data/WsListQuery?` + qs.toString()
  return baseService.post(api, param, {
    baseURL: '/'
  })
}

/**
 * 机型
 * @param param
 */
export const modelQuery: (param) => Promise<String> = (param) => {
  let qs = new URLSearchParams()
  if (param) {
    Object.keys(param).forEach((key) => qs.append(key, param[key]))
  }
  const api = `/data/ModelQuery?` + qs.toString()
  return baseService.post(api, param, {
    baseURL: '/'
  })
}

/**
 * 机型
 * @param param
 */
export const facListQuery: (param) => Promise<String> = (param) => {
  let qs = new URLSearchParams()
  if (param) {
    Object.keys(param).forEach((key) => qs.append(key, param[key]))
  }
  const api = `/data/FacListQuery?` + qs.toString()
  return baseService.post(api, param, {
    baseURL: '/'
  })
}
